import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/layout",
  },
  {
    path: "/login",
    component: () => import("@/views/login/loginView.vue"),
  },
  {
    path: "/register",
    component: () => import("@/views/register/registerView.vue"),
  },
  {
    path: "/goodsList",
    component: () => import("@/views/goodsList/indexView.vue"),
  },
  {
    path: "/goodsDetails",
    component: () => import("@/views/goodsDetails/DetailsView.vue"),
  },
  {
    path: "/buy",
    name: "buy",
    component: () => import("@/views/buy/buyView.vue"),
  },
  {
    path: "/layout",
    name: "layout",
    component: () => import("@/views/layout/layoutView.vue"),
    redirect: "/home",
    children: [
      {
        path: "/person",
        name: "person",
        component: () => import("@/views/my/personView.vue"),
      },
      {
        path: "/shop",
        name: "shop",
        component: () => import("@/views/shop/shopView.vue"),
      },
      {
        path: "/home",
        name: "home",
        component: () => import("@/views/home/homeView.vue"),
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
